<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    * {
      box-sizing: border-box;
    }
    .container {
      width: 260px;
      height: 260px;
      font-size: 12px;
    }
    .style-grid {
      width: 100%;
      height: 100%;
      position: relative;
      display: grid;
      overflow: hidden;
      border: 1px solid #000;
      grid-template-columns: 24px auto 24px;
      grid-template-rows: 24px auto 24px;
      justify-items: center;
      align-items: center;
    }
    .style-grid > div:not(.style-inner) {
      border: 1px solid red;
    }
    .style-grid > div.style-inner {
      width: 100%;
      height: 100%;
    }

  </style>
</head>
<body>

<div class="container">
  <div class="grid">
    <div style="position: relative;"><span style="position: absolute;top: -10px;">position</span></div>
    <div>{top}</div>
    <div></div>
    <div>{l}</div>
    <div class="inner">
      <div class="grid">
        <div style="position: relative;"><span style="position: absolute;top: -10px;font-size: 12px;">margin</span></div>
        <div>{top}</div>
        <div></div>
        <div>{l}</div>
        <div class="inner">
          <div class="grid">
            <div style="position: relative;"><span style="position: absolute;top: -10px;font-size: 12px;">border</span></div>
            <div>{top}</div>
            <div></div>
            <div>{l}</div>
            <div class="inner">
              <div class="grid">
                <div style="position: relative;"><span style="position: absolute;top: -10px;font-size: 12px;">padding</span></div>
                <div>{top}</div>
                <div></div>
                <div>{l}</div>
                <div class="inner">{children}</div>
                <div style="overflow: hidden; width: 100%;">{right}</div>
                <div></div>
                <div>{bottom}</div>
                <div></div>
              </div>
            </div>
            <div style="overflow: hidden; width: 100%;">{right}</div>
            <div></div>
            <div>{bottom}</div>
            <div></div>
          </div>
        </div>
        <div style="overflow: hidden; width: 100%;">{right}</div>
        <div></div>
        <div>{bottom}</div>
        <div></div>
      </div>
    </div>
    <div style="overflow: hidden; width: 100%;">{right}</div>
    <div></div>
    <div>{bottom}</div>
    <div></div>
  </div>
</div>
</body>
</html>